package com.example.gzysmartcity.ui.fragment.me;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.example.gzysmartcity.R;
import com.example.gzysmartcity.databinding.FragmentHistoryjBinding;
import com.example.gzysmartcity.ui.adapter.HistoryAdapter;
import com.example.gzysmartcity.ui.base.BaseFragment;
import com.example.gzysmartcity.viewmodel.HistoryViewModel;

import org.jetbrains.annotations.NotNull;

public class HistoryFragment extends BaseFragment<FragmentHistoryjBinding> {
    @Override
    protected FragmentHistoryjBinding viewBinding() {
        return FragmentHistoryjBinding.inflate(getLayoutInflater(), baseBinding.getRoot(), true);
    }

    @Override
    public void onViewCreated(@NonNull @NotNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        b.rvHostriy.setLayoutManager(new LinearLayoutManager(getContext()));
        HistoryViewModel historyViewModel = new ViewModelProvider(this).get(HistoryViewModel.class);
        HistoryAdapter adapter = new HistoryAdapter(R.layout.rv_news_item);
        b.rvHostriy.setAdapter(adapter);
        adapter.setNewInstance(historyViewModel.getAllData());
    }

    @Override
    protected String setTitle() {
        return "历史反馈";
    }

    @Override
    protected boolean showBack() {
        return true;
    }

    @Override
    protected Boolean showBottom() {
        return false;
    }
}
